﻿using System;

namespace Coding4Fun.Cannon.TechEdPhone.Complete
{
    public static class CannonAim
    {
        //How Fast to pan 
        public static double PanSpeed { get; set; }

        //the current pan 
        public static double CurrentPan { get; private set; }

        static CannonAim()
        {
            PanSpeed = .3;

            //Starting values
            CurrentPan = 0;


        }


        public static double CalculatePan(double yAxis)
        {
            TurningAction turn = CannonUtility.GetTurn(yAxis);

            switch (turn)
            {
                case TurningAction.Left:
                    CurrentPan += PanSpeed; 
                    break;
                case TurningAction.Right:
                    //right is negative
                    CurrentPan -= PanSpeed;
                    break;
                case TurningAction.None:
                    break;
                default:
                    break;
            }
            return CurrentPan; 
        }


        

    }
}
